<template>
    <view class="select_date_input_cp">
        <u-input
			class="u-input"
            v-model="date" 
            type="select" 
            @click="show = true"
            placeholder="请选择时间日期"/>
        <u-picker 
            mode="time" 
            v-model="show" 
            :params="{
                year:true,
                month:true,
                day:true,
            }"
            @confirm="confirm"> 
        </u-picker>
    </view>
</template>

<script>
//日期选择input组件
export default {
    name:"SelectDateInputCp",
    props:{
        value:{
            type:String,
            default:'',
        },
    },
    data() {
        return {
            show: false,
        }
    },
    computed:{
        date:{ //日期
            get(){
                return this.value;
            },
            set(value){
                this.$emit('input',value);
            },
        },
    },
    methods:{
        confirm(e) {
            this.date = e.year+'-'+e.month+'-'+e.day;
        }
    },
}
</script>

<style lang="scss" scoped>
.select_date_input_cp {
    text-align: center;
    width: 100%;
    /deep/.u-input{
        width: 100%;
    }
}
</style>
